package org.example.basic.functionclass;

import java.util.function.BooleanSupplier;

/**
 * 	BooleanSupplier
 * 代表了boolean值结果的提供方
 * @author songyafei
 */
public class BooleanSupplierFunction {

    public static void main(String[] args) {
       run(()->true);
       run(()->false);
    }

    public static boolean run(BooleanSupplier supplier){
        boolean asBoolean = supplier.getAsBoolean();
        if(asBoolean){
            System.out.println("执行true的业务逻辑");
        }else{
            System.out.println("执行false的业务逻辑");
        }
        return asBoolean;
    }
}
